<%inherit file="/unmenued_base.mako"/>
<%namespace file="breadcrumbs.mako" import="make_breadcrumbs" />

<%def name="head()">
</%def>

<%def name="content()">
<h2>${c.league.name}</h2>
${make_breadcrumbs(c.breadcrumbs)}

% for stage in c.child_stages:
<div class="stage">
	<h3>
		<a href="/${h.make_stage_url(c.league.name_key, c.stage_path, stage.name_key)}">
			${stage.name}
		</a>
	</h3>
	<h4>${h.render_date_range(stage.start_date, stage.end_date)}</h4>
	${self.render_match_list(c.stage_path, stage)}
</div>
% endfor

${self.render_match_list(c.stage_path[:-1], c.current_stage)}
</%def>

<%def name="render_match_list(stage_path, stage)">
% if len(stage.matches) > 0:
	<div class="match_list">
		<ul class="match_list">
			% for match in stage.matches.values():
				<li>
					<a href="/${h.make_match_url(c.league.name_key, stage_path, stage.name_key,
						match.team_one.name_key, match.team_two.name_key)}">
						${match.team_one.name} vs. ${match.team_two.name}
					</a>
				</li>
			% endfor
		</ul>
	</div>
% endif
</%def>
